<html>
  <head>
	<style type="text/css">
/*
Theme Name: greenZi
Theme URI: http://ziworks.com/
Description: greenZi was designed and built specially for <a href="http://modxcms.com">MODxCMS</a>.
Version: 1.0
Author: <a href="http://zidesigns.com">Zaigham Rana</a>
ALL RIGHTS RESERVED.
--------------------
*/

/* Neutralize styling: 
   Elements we want to clean out entirely
   and we reset the base font-size to 10px
---------------------------------------------------------------- */
html, body, form, fieldset {
    margin: 0;
    padding: 0;
    font: normal 100.01%/1.5em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
	text-align: left;
}
html { font-size: 62.5%; } /* 1em = 10px */
html { font-size: 86%; } /* override it ... go bigger */

/* Neutralize styling: 
   Elements with a vertical margin
---------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6, p, pre,
blockquote, ul, ol, dl, address {
    margin:  .5em 0;
    padding: 0;
}

/* Apply left margin:
   Only to the few elements that need it
---------------------------------------------------------------- */
li, dd, blockquote {
    margin-left: 1em;
}

/* Miscellaneous conveniences
---------------------------------------------------------------- */
form label {
    cursor: pointer;
}
fieldset {
    border: none;
}
input, select, textarea, td {
    font-size: 100%;
}
html {
    height: 100%;
    margin: 0 0 1px;
    padding: 0;
}

body {
    color: #000;
    background: #111;
    height: 100%;
    text-align: left;
}
.clear {
    clear: both;
    line-height: 1px;
    font-size: 1px;
    height: 1px;
    margin-top: -1px;
    visibility: hidden;
}

/* Headers and Paragraphs:
---------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: "Lucida Grande", Arial, "Lucida Sans Unicode", sans-serif; 
    font-weight: normal;
    line-height: 1.1em;
    color: #111;
    padding-bottom: 3px;
    border-bottom: 2px solid #9c0;
	text-align: left;
}
h4, h5, h6 {
    line-height: 1.3em;
    border: 0;
	text-align: left;
}

h1 { font-size: 218%; }
h2 { font-size: 164%; }
h3 { font-size: 145%; border-width: 1px }
h4 { font-size: 118%; }
h5 { font-size: 100%; font-weight: bold; }
h6 { font-size: 86%; font-weight: bold; }

p, ul, ol, td { color: #333; }
.caption, .note { color: #000000; background-color: #FFCC00; padding: 2px 5px 2px 5px; }

/* Layout
------------------------------------------------ */

#container {
    width: 775px;
    background-color: #fff !important;
    border: 1px solid #222;
    border-top: 0;
}

#content {
    background-color: #fff !important;
    padding: 15px 25px 0 35px;
    float: left;
    width: 100%;
}

#skip { display: none; }


/* Content formating
------------------------------------------------ */
p {
    padding: .5em 0 .5em 0;
}

p.intro {
    font-weight: bold;
}

.blocktitle { 
    font-size: 145%; 
    border-width: 2px;
    margin-top: 0;
}


abbr {
    border-bottom: 1px solid #999;
}

abbr:hover {
    border-bottom-color: #9c0;
    color: #666;
}

a, a:link, a:visited {
    color: #33c;
    text-decoration: underline;
}

a:active {
    color: #fff;
    background: #333;
	text-decoration: none;
}

a:hover {
    color: #006;
	text-decoration: none;
}

/* Content Styling
------------------------------------------------ */

#content a:active {
    color: #fff;
    background: #9c0;
    border: 0;
}

/* Fancy Stuff */

.version , .version a:link{
    font-size: 200%;
    font-weight: bold;
    border: none;
    text-decoration: none;
}

/* Recent forum disscussions on Homepage */

table.ssi_table {
    border-left: 1px solid #ededed;
    border-top: 1px solid #ddd;
}
.ssi_table td {
    padding: 3px 10px;
    vertical-align: top;
    border: 1px solid #ededed;
    border-width: 0 1px 1px 0;
    font-size: 86%;
}
.ssi_table thead th {
    background-color: #ededed;
    border: 1px solid #ddd;
    border-width: 0 1px 1px 0;
}
.ssi_table tr {
    border-bottom: 1px solid #ededed;
}
.ssi_table tr.altrow {
    background-color: #ededed;
}
.ssi_table tr:hover {
    background-color: #fff;
}
.ssi_table_forum_name {
    background: #fafafa;
    text-align: left;
    border-right: 1px solid #ededed;
    padding-left: 5px;
}
.ssi_table_topic {
    text-align: left;
    padding: 10px 0 1px 0;
    border: 0;
}
.ssi_table_author, .ssi_table_author a {
    color: #333;
    padding: 10px 0 0;
    border: 0;
}
.ssi_table_author a, .ssi_table_author a:visited {
    border: 0;
    color: #111;
}
.ssi_table_author a:hover, .ssi_table_author a:active {
    border-bottom: 1px solid #333;
}
.ssi_table_time {
    color: #999;
    font-size: 86%;
}

/* Form styles
------------------------------------------------ */

input {
    font-size: 1em;
}

input:focus {
    background: #fff;
    color: #111;
}

/* Documentation styles
------------------------------------------------ */

code {
    display: block;
    padding: 10px;
    margin: 6px 0;
    color: #900;
    background: #ffffe6;
    font-size: 12px;
    line-height: 1.6em;
    border-top: 2px solid #eee;
    border-bottom: 2px solid #eee;
    overflow: auto;
	text-align: left;
}

img.dotted {
    border: 1px solid #111;
    padding: 3px;
    margin: 9px;
}

#tools {
    padding: 5px;
    background: #fafafa;
    line-height: normal;
    margin: 0;
    color: #999;
}

#tools p {
    margin: 0;
    padding: 0;
}

#tools a, #tools a:hover {
    border: 0;
    background: none;
}

#tools p.hide-me {
    display: none;
}

/* API styles
------------------------------------------------ */

.pre {
    display: inline;
    clear: none;
    color: #900;
    font-family: courier, monospace;
	text-align: left;
}

.legend_on_off {
    font-size: 11px;
    font-weight: normal;
}

.row1 {
    background: #eee;
}
.row2 {
    background: #f7f7f7;
}

.proptable {
    border: 1px dashed #999;
}
    
dl { 
    border-bottom: 1px solid #33c;
    background: #fafafa;
}

dt {
    width: 10em;
    padding: .5em;
    float: left;
    margin: 0;
    border-top: 1px solid #33c;
    font-weight: bold;
}

dd {
    margin-left: 11em;
    padding: .5em;
    border-top: 1px solid #33c; 
}

div.PrevNextMenu {
    display: block;
    border-bottom: 2px double #eee;
}

.PrevNextMenu div {
    border: 2px double #eee;
    border-top: none;
    padding: 5px 4px 2px;
    margin: 3px 0 0;
    float: right;
    display: block;
    background-color: #fafafa;
    font-size: 70%;
}

.apiFunction {
    color: blue;
    font-size: 12px;
}
.apiParameters {
    color: green;
    font-size: 12px;
}
.apiReturned {
    color: red;
    font-size: 12px;
}
.deprecated {
	text-decoration: line-through
}
	</style>
    <title>NewsManager</title>
  </head>
  <body>
    <div id="container">
	  <div id="content">
	    <h1>NewsManager</h1>
		<h2>General Information</h2>
		<table>
		  <tbody>
		    <tr><td>Snippet Name:</td><td>NewsManager</td></tr>
		    <tr><td>Short Desc:</td><td>Manage articles directly from front end (news, blogs, PR, etc.)</td></tr>
		    <tr><td>Created By:</td><td>xyzvisual</td></tr>
		    <tr><td>Version:</td><td>1.3</td></tr>
		    <tr><td>Modified:</td><td>September 19, 2006</td></tr>
		  </tbody>
		</table>
		<h2>Changelog</h2>
		<table>
		 <tbody>
		 <tr><td>Sep 19, 06</td><td>rewrite and documentation [tfd]</td></tr>
		 </tbody>
		</table>
		<h2>Description</h2>
		<p>Display all owned articles in a table together with buttons
           that permit to edit/delete/hide/publisch etc. every single
           article in a blog.</p>
		<p>!!! Use only one snippet per page !!!</p>
		<h2>Parameters</h2>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Parameter</th><th>Description</th><th>Default value</th></tr>
		  </thead>
		  <tbody>
            <tr><td>&folder     </td><td>folder id where documents are stored</td><td></td></tr>
            <tr><td>&makefolder </td><td>set to 1 to automatically convert the parent document to a folder.</td><td>0</td></tr>
            <tr><td>&postid     </td><td>document id to load after working with a news item.</td><td>current page</td></tr>
            <tr><td>&editformid </td><td>document id used to modify an article ($_REQUEST['editid'] will hold the id of the document to modify)</td><td>&nbsp;</td></tr>
            <tr><td>&template   </td><td>name of template to use for news post</td><td>&nbsp;</td></tr>
            <tr><td>&headertpl  </td><td>header template (chunk name) to be inserted at the begining of the news content</td><td>&nbsp;</td></tr>
            <tr><td>&footertpl  </td><td>footer template (chunk name) to be inserted at the end of the news content</td><td>&nbsp;</td></tr>
            <tr><td>&rowtpl     </td><td>template used to display a single post (chunk name)</td><td>&nbsp;</td></tr>
            <tr><td>&clearcache </td><td>when set to 1 the system will automatically clear the site cache after updating an article</td><td>&nbsp;</td></tr>
            <tr><td>&nrposts    </td><td>number of posts to show per page</td><td>10</td></tr>
            <tr><td>&paginate   </td><td>paginate</td><td>0</td></tr>
            <tr><td>&prv        </td><td>chunk to be used inside the previous link</td><td>"&lt; Previous"</td></tr>
            <tr><td>&nxt        </td><td>chunk to be used inside the next link</td><td>"Next &gt;"</td></tr>
            <tr><td>&alwaysshow </td><td>always show previous or next links (if enabled, hyperlink will be removed when prev/next page is not available, | delimiter will not be inserted)</td><td>0</td></tr>
            <tr><td>&prevnextsplitter</td><td>character delimiter to use to separate previous next links if alwaysshow is 0 </td><td>"|"</td></tr>
            <tr><td>&show       </td><td>chunk to be used for the show action</td><td>"Show"</td></tr>
            <tr><td>&edit       </td><td>chunk to be used for the edit action</td><td>"Edit"</td></tr>
            <tr><td>&delete     </td><td>chunk to be used for the delete action</td><td>"Delete"</td></tr>
            <tr><td>&refresh    </td><td>chunk to be used for the "move on top" action</td><td>"Move on top"</td></tr>
            <tr><td>&publish    </td><td>chunk to be used for the publish action</td><td>"Publish"</td></tr>
            <tr><td>&unpublish  </td><td>chunk to be used for the unpublish action</td><td>"Unpublish"</td></tr>
            <tr><td>&showinmenu </td><td>chunk to be used for the "Show in menu" action</td><td>"Show in menu"</td></tr>
            <tr><td>&hideinmenu </td><td>chunk to be used for the "Hide in menu" action</td><td>"Remove from menu"</td></tr>
            <tr><td>&emptytext  </td><td>text to use when no news items are found</td><td>"&lt;p>No entries found.&lt;/p>"</td></tr>
		  </tbody>
		</table>
        <h2>Request variables (via GET, POST, or COOKIE)</h2>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Request variables</th><th>Description</th></tr>
		  </thead>
		  <tbody>
            <tr><td>deleteid     </td><td>id of post to delete</td></tr>
            <tr><td>refreshid    </td><td>id of post for whic the 'createdon' property is set to now, thus effectively putting it at the top of the list</td></tr>
            <tr><td>hidemenuid   </td><td>id of post for which the 'hidemenu' property must be changed</td></tr>
            <tr><td>hidemenuvalue</td><td>value to which 'hidemenu' must be set</td></tr>
            <tr><td>publishid    </td><td>id of post for which the 'published' property must be changed</td></tr>
            <tr><td>publishvalue </td><td>value to which 'published' must be set</td></tr>
		  </tbody>
		</table>
		<h2>Important Notes</h2>
		<p>When in pagination mode (&paginate = 1) always call the snippet uncached in the [!NewsManager!] format
           Also, in pagination mode, make sure to use the placeholders for navigation!</p>
		<p>To display tv's make sure you use the tv prefix! For example, if you
		   have the template variable author you would put [+tvauthor+] in your template.</p>
		<h2>Snippet placeholders</h2>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Placeholder</th><th>Description</th></tr>
		  </thead>
		  <tbody>
            <tr><td>[+sepchar+]   </td><td>separator between a document URL and parameters
                                           (for example [~[*id*]~][+sepchar+]param1=value1&param2=value2)</td></tr>
            <tr><td>[+editformid+]</td><td>Id of page to use for editing a post</td></tr>
            <tr><td>[+pagetitle+] </td><td>current post's page title</td></tr>
            <tr><td>[+longtitle+] </td><td>current post's article title</td></tr>
            <tr><td>[+id+]        </td><td>current post's id</td></tr>
            <tr><td>[+edit+]      </td><td>text for edit action</td></tr>
            <tr><td>[+delete+]    </td><td>text for delete action</td></tr>
            <tr><td>[+show+]      </td><td>text for show action</td></tr>
            <tr><td>[+refresh+]   </td><td>text for refresh action (update the creation date to now so the post is first in the list)</td></tr>
            <tr><td>[+hidemenu+]  </td><td>text for hide menu action or show menu action (dependent of the current state of the post)</td></tr>
            <tr><td>[+pubish+]    </td><td>text for publish action or unpublish action (dependent of the current state of the post)</td></tr>
            <tr><td>[+next+]      </td><td>text for next action</td></tr>
            <tr><td>[+previous+]  </td><td>text for previous action</td></tr>
            <tr><td>[+prevnextsplitter+]</td><td>splitter if always show is 0</td></tr>
            <tr><td>[+pages+]     </td><td>page list</td></tr>
            <tr><td>[+totalpages+]</td><td>total number of pages</td></tr>
            <tr><td>[+start+]     </td><td>the # of the first item shown</td></tr>
            <tr><td>[+stop+]      </td><td>the # of the last item shown</td></tr>
            <tr><td>[+total+]     </td><td>the total # of items on the page</td></tr>
		  </tbody>
		</table>
		<h2>Examples</h2>
        <p>Minimal</p>
		<code><pre>[!NewsManager? &folder=`2` &editformid=`3`!]</pre></code>
        <p></p>Personalized template</p>
		<code><pre>[!NewsManager? &folder=`2` &editformid=`3` &rowtpl=`MyTemplate`!]</pre></code>
		<h2>Personalization</h2>
		<p>The tricky part. I tried to make the snippet as flexible as possible,
           but actually that means that you have to be very carefull when you make
           templates. The used templates are:</p>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Placeholder</th><th>Description</th></tr>
		  </thead>
		  <tbody>
            <tr><td>&rowtpl     </td><td>template used to display a single post (chunk name)</td></tr>
            <tr><td>&headertpl  </td><td>header template (chunk name) to be inserted at the begining of the news content</td></tr>
            <tr><td>&footertpl  </td><td>footer template (chunk name) to be inserted at the end of the news content</td></tr>
		  </tbody>
		</table>
		<p>The usage of this templates is easy. In pseudocode:</p>
		<code><pre>Initialize global placeholders
Insert $headertpl (first replace chunks, then replace placeholders)
For each post
  Initialize placeholders relative to the post (like [+id+], [+title+], etc.) 
  Insert $rowtpl (first replace chunks, then replace placeholders)
Insert $footertpl (first replace chunks, then replace placeholders)
</pre></code>
        <p>The default $rowtpl, however, is quite complex:</p>
        <code><pre><div class="[+rowclass+]">
  &lt;!-- Show the title of the post -->
  &lt;div class="nm_title">[+pagetitle+]&nbsp;|&nbsp;[+longtitle+]&lt;/div>
  &lt;!-- Now display the various operations possible with this post -->
  &lt;div class="nm_button">
    &lt;!-- Show the post -->
    &lt;form name="formshow" method="post" action="[~[+id+]~]">
      &lt;input type="submit" class="button" name="show" value="[+show+]" />
    &lt;/form>
  &lt;/div>
  &lt;div class="nm_button">
    &lt;!-- Modify the post -->
    &lt;form name="formedit" method="post" action="[~[+editformid+]~]">
      &lt;input name="editid" type="hidden" value="[+id+]" />
      &lt;input type="submit" class="button" name="edit" value="[+edit+]" />
    &lt;/form>
  &lt;/div>
  &lt;div class="nm_button">
    &lt;!-- Delete the post -->
    &lt;form name="formdelete[+id+]" method="post" action="">
      &lt;input name="deleteid" type="hidden" value="[+id+]" />
      &lt;input type="submit" class="button" onclick="JavaScript: return doDelete[+id+]();" name="delete" value="[+delete+]" />
    &lt;/form>
  &lt;/div>
  &lt;div class="nm_button">
    &lt;!-- Put the post on top of the list -->
    &lt;form name="formrefresh" method="post" action="">
      &lt;input name="refreshid" type="hidden" value="[+id+]" />
       &lt;input type="submit" class="button" name="refresh" value="[+refresh+]" />
    &lt;/form>
  &lt;/div>
  &lt;div class="nm_button">
    &lt;!-- Show/hide in the menu -->
    &lt;form name="formhide" method="post" action="">
      &lt;input name="hidemenuvalue" type="hidden" value="[+hidevalue+]" />
      &lt;input name="hidemenuid" type="hidden" value="[+id+]" />
      &lt;input type="submit" class="button" name="hidemenu" value="[+hidemenu+]" />
    &lt;/form>
  &lt;/div>
  &lt;div class="nm_button">
    &lt;!-- Publish/unpublish the post -->
    &lt;form name="formpublish" method="post" action="">
      &lt;input name="publishvalue" type="hidden" value="[+publishvalue+]" />
      &lt;input name="publishid" type="hidden" value="[+id+]" />
      &lt;input type="submit" class="button" name="publish" value="[+publish+]" />
    &lt;/form>
  &lt;/div>
  &lt;!-- Make sure the next post begins on  a new line -->
  &lt;span class="nm_eol">&nbsp;&lt;/span>
&lt;/div></pre></code>
        <p>You can see that the template has a lot of code: it completly formats
           the post with buttons for each action. Personalization of the buttons
           is possible via placeholders which can be loaded from chunks via the
           command line. The following chunks are defined:</p>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Parameter</th><th>Placeholder</th><th>Description</th><th>Default value</th></tr>
		  </thead>
		  <tbody>
            <tr><td>&prv        </td><td>[+prv+]</td><td>chunk to be used inside the previous link</td><td>"&lt; Previous"</td></tr>
            <tr><td>&nxt        </td><td>[+nxt+]</td><td>chunk to be used inside the next link</td><td>"Next &gt;"</td></tr>
            <tr><td>&show       </td><td>[+show+]</td><td>chunk to be used for the show button</td><td>"Show"</td></tr>
            <tr><td>&edit       </td><td>[+edit+]</td><td>chunk to be used for the edit button</td><td>"Edit"</td></tr>
            <tr><td>&delete     </td><td>[+delete+]</td><td>chunk to be used for the delete button</td><td>"Delete"</td></tr>
            <tr><td>&refresh    </td><td>[+refresh+]</td><td>chunk to be used for the "move on top" button</td><td>"Move on top"</td></tr>
            <tr><td>&publish    </td><td>[+publish+]</td><td>chunk to be used for the publish button</td><td>"Publish"</td></tr>
            <tr><td>&unpublish  </td><td>[+publish+]</td><td>chunk to be used for the unpublish button</td><td>"Unpublish"</td></tr>
            <tr><td>&showinmenu </td><td>[+hide+]</td><td>chunk to be used for the "Show in menu" button</td><td>"Show in menu"</td></tr>
            <tr><td>&hideinmenu </td><td>[+hide+]</td><td>chunk to be used for the "Hide in menu" button</td><td>"Remove from menu"</td></tr>
		  </tbody>
		</table>
        <p>Note that both $publish and $unpublish end up in the placeholder [+pubish+].
           This is because the correct chunk is selected dependent on the state of
           the post. The same is true for $showinmenu and $hideinmenu.</p>
        <p>The next interesting thing is</p>
		<code><pre>&lt;div class="[+rowclass+]"></pre></code>
		<p>[+rowclass+] will translate in nm_row_even or nm_row_odd dependent on the row number.
           In this way you can provide alternate coloring via the syle sheet.</p>
        <p>Finally the operations. Delete, refresh, hide/show in menu, and
           publisch/unpublish are performed by the snippet itself. To achieve the
           correct action you just pass the document a series of parameters in
           the $_GET, $_POST, or $_COOKIE array:</p>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Parameter</th><th>Description</th></tr>
		  </thead>
		  <tbody>
            <tr><td>delete</td><td>set 'deleteid' to the id of the post to delete
                                   (for example '&lt;a href="[~[+docid+]~][+sepchar+]deleteid=5">[+delete+]&lt;/a>')</td></tr>
            <tr><td>refresh</td><td>set 'refreshid' to the id of the post for which the
                                    createdon date must be set to now  (for example '&lt;a href="[~[+docid+]~][+sepchar+]refreshid=5">[+refresh+]&lt;/a>')
            <tr><td>hide/show</td><td>set 'hidemenuid' to the id of the post to update and
                                      'hidemenuvalue' to the new value of the 'hidemenu'
                                      property (for example '&lt;a href="[~[+docid+]~][+sepchar+]hidemenuid=5&hidemenuvalue=0">[+hidemenu+]&lt;/a>')</td></tr>
            <tr><td>publish/unpublish</td><td>set 'publishid' to the id of the post to update and
                                              'publishvalue' to the new value of the 'published'
                                               property (for example '&lt;a href="[~[+docid+]~][+sepchar+]publishid=5&publishvalue=1">[+publish+]&lt;/a>')</td></tr>
		  </tbody>
		</table>
		<p>For the edit action you must specify the id of the page which holds
           the NewsEditor snippet in the $editformid parameter. The NewsManager will
           pass the id of the post to edit in $_REQUEST['editid'].</p>
		<p>One final observation: the NewsManager creates a JavaScript function
           doDelete[+id+]() for every id. This function will ask the user is he is
           sure and return true if the user presses ok, false otherwise. This explains
           why the submit button for the $delete action is</p>
		<code><pre>&lt;input type="submit" onClick="JavaScript: return doDelete[+id+]();" class="button" name="delete" value="[+delete+]" /></pre></code>
		<p>the form will be submitted only if the user
           acknowledges the delete.</p>
        <hr>
	    <h1>NewsEditor</h1>
	    <h2>General information</h2>
	    <table>
	      <tr><td>Snippet Name:</td><td>NewsEditor</td></tr>
	      <tr><td>Based on:</td><td>NewsPublisher</td></tr>
	      <tr><td>Short Desc:</td><td>Create or edit articles directly from front end (news, blogs, PR, etc.)</td></tr>
	      <tr><td>Created By:</td><td>Raymond Irving (xwisdom@yahoo.com), August 2005</td></tr>
	      <tr><td>Version:</td><td>1.4</td></tr>
	      <tr><td>Modified:</td><td>September 22, 2006</td></tr>
	    </table>
	    <h2>Changelog</h2>
	    <table>
	      <tr><td>Sep 22, 06</td><td>NewsEditor works also for publishing. Removed $edittpl parameter [tfd]</td></tr>
	      <tr><td>Sep 19, 06</td><td>Added the posibility to update an existing news item [tfd]<br />Heavily based on work from xyzvisual (thanks for the input)</td></tr>
	      <tr><td>Mar 05, 06</td><td>modx_ prefix removed [Mark]</td></tr>
	      <tr><td>Dec 13, 05</td><td>Now inherrits web/manager docgroups thanks to Jared Carlow</td></tr>
	    </table>
	    <h2>Description</h2>
	    <p>Checks to see if users belong to a certain group and 
	    displays the specified chunk if they do. Performs several
	    sanity checks.</p>
	    <p>Permits to be used both for creating and editing a post.</p>
	    <p>Only meant to be used once per page.</p>
	    <h2>Parameters</h2>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Parameter</th><th>Description</th><th>Default value</th></tr>
		  </thead>
		  <tbody>
	        <tr><td>&folder</td><td>folder id where comments are stored
	        <tr class="altrow"><td>&makefolder</td><td>set to 1 to automatically convert the parent document to a folder</td><td>0</td></tr>
	        <tr><td>&postid</td><td>document id to load after posting news item.</td><td>Id of page created or edited</td></tr>
	        <tr class="altrow"><td>&canpost</td><td>comma delimitted web groups that can post comments. leave blank for public posting</td><td>''</td></tr>
	        <tr><td>&badwords</td><td>comma delimited list of words not allowed in post</td><td></td></tr>
	        <tr class="altrow"><td>&template</td><td>name of template to use for news post</td><td></td></tr>
	        <tr><td>&headertpl</td><td>header template (chunk name) to be inserted at the begining of the news content</td><td></td></tr>
	        <tr class="altrow"><td>&footertpl</td><td>footer template (chunk name) to be inserted at the end of the news content</td><td></td></tr>
	        <tr><td>&formtpl</td><td>form template (chunk name)</td><td></td></tr>
	        <tr class="altrow"><td>&rtcontent</td><td>name of a richtext content form field</td><td>'content'</td></tr>
	        <tr><td>&rtsummary</td><td>name of a richtext summary form field</td><td>'introtext'</td></tr>
	        <tr class="altrow"><td>&showinmenu</td><td>sets the flag to true or false (1|0) as to whether or not it shows in the menu.</td><td>0</td></tr>
	        <tr><td>&aliastitle</td><td>set to 1 to use page title as alias suffix</td><td>0</td></tr>
	        <tr class="altrow"><td>&clearcache</td><td>when set to 1 the system will automatically clear the site cache after publishing an article</td><td>0</td></tr>
	        <tr><td>&dateformat</td><td>format to use for the dates</td><td>'%d-%m-%Y&nbsp;%H:%M:%S'</td></tr>
		  </tbody>
	    </table>
	    <h2>URL parameters</h2>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
	      <thead><tr><th>URL Parameter</th><th>Description</th></tr></thead>
	      <tbody><tr><td>editid</td><td>Id of document to be edited</td></tr></tbody>
	    </table>
	    <h2>Placeholders</h2>
	    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ssi_table">
		  <thead>
	        <tr><th>Placeholder</th><th>Description</th></tr>
		  </thead>
		  <tbody>
	        <tr><td>editid</td><td>Id of news document</td></tr>
	        <tr class="altrow"><td>pagetitle</td><td>News page title</td></tr>
	        <tr><td>longtitle</td><td>News title</td></tr>
	        <tr class="altrow"><td>description</td><td>News description</td></tr>
	        <tr><td>introtext</td><td>News summary</td></tr>
	        <tr class="altrow"><td>alias</td><td>News page alias</td></tr>
	        <tr><td>parent</td><td>News parent folder (the folder with the blog)</td></tr>
	        <tr class="altrow"><td>createdon</td><td>Date in which the news was first created</td></tr>
	        <tr><td>createdby</td><td>User id of creator</td></tr>
	        <tr class="altrow"><td>published</td><td>News is published (0|1)?</td></tr>
	        <tr><td>pub_date</td><td>Data on which the news must be published (format %d-%m-%Y&nbsp;%H:%M:%S)</td></tr>
	        <tr class="altrow"><td>unpub_date</td><td>Data on which the news must be unpublished (format %d-%m-%Y&nbsp;%H:%M:%S)</td></tr>
	        <tr><td>hidemenu</td><td>News isn't displayed in menu (0|1)?</td></tr>
	        <tr class="altrow"><td>menuindex</td><td>If hidemenu == 0, gived the place of the news in the menu</td></tr>
	        <tr><td>template</td><td>Id of template for this news (note: not the name of the template)</td></tr>
	        <tr class="altrow"><td>content</td><td>News content</td></tr>
		  </tbody>
	    </table>
	    <h2>Examples</h2>
	    <p>Basic usage (default template, redirect to news page after updating, put
	       document in folder with id 10 using the default template.</p>
	    <code><pre>[!NewsEditor? &folder=`10`!]</pre></code>
	    <p>Custom form with date in American format. Returns to page 2 after the update.</p>
	    <code><pre>[!NewsEditor? &folder=`10` &postid=`2` &formtpl=`NewsEditorForm` &dateformat=`%m-%d-%y %h.%m.%s`!]</pre></code>
	    <p>Custom form with template variable for the contents.</p>
	    <code><pre>[!NewsEditor? &folder=`10` &postid=`2` &formtpl=`NewsEditorForm` &rtcontent=`tvContent`!]</pre></code>
		<p class="note">Always use the NewsEditor in uncached mode ([!NewsEditor!] instead of [[NewsEditor]])
		   because otherwise the $_POST variables don't work.</p>
	    <h2>Templates</h2>
	    <h3>Default template</h3>
	    <code><pre>&lt;form name="ne_form" method="post" action="[~[*id*]~]">
  &lt;!-- These 2 hidden input fields must be present in any custom NewsEditor form. -->
    &lt;input name="NewsEditorForm" type="hidden" value="on" />
    &lt;input name="editid" type="hidden" value="[+editid+]" />
  &lt;!-- End of mandatory fields. -->
  Page title:&lt;br />&lt;input name="pagetitle" type="text" size="40" value="[+pagetitle+]" />&lt;br />
  Long title:&lt;br />&lt;input name="longtitle" type="text" size="40" value="[+longtitle+]" />&lt;br />
  Description:&lt;br />&lt;input name="description" type="text" size="40" value="[+description+]" />&lt;br />
  Published date:&lt;br />&lt;input name="pub_date" type="text" value="[+pub_date+]" size="40" readonly="readonly" />
    &lt;a onClick="nwpub_cal1.popup();" onMouseover="window.status=\'Select date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand">&lt;img align="absmiddle" src="manager/media/images/icons/cal.gif" width="16" height="16" border="0" alt="Select date" />&lt;/a>
    &lt;a onClick="document.NewsEditor.pub_date.value=\'\'; return true;" onMouseover="window.status=\'Remove date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand">&lt;img align="absmiddle" src="manager/media/images/icons/cal_nodate.gif" width="16" height="16" border="0" alt="Remove date">&lt;/a>&lt;br />
  Unpublished date:&lt;br />&lt;input name="unpub_date" type="text" value="[+unpub_date+]" size="40" readonly="readonly" />
    &lt;a onClick="nwpub_cal2.popup();" onMouseover="window.status=\'Select date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand">&lt;img align="absmiddle" src="manager/media/images/icons/cal.gif" width="16" height="16" border="0" alt="Select date" />&lt;/a>
    &lt;a onClick="document.NewsEditor.unpub_date.value=\'\'; return true;" onMouseover="window.status=\'Remove date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand">&lt;img align="absmiddle" src="manager/media/images/icons/cal_nodate.gif" width="16" height="16" border="0" alt="Remove date">&lt;/a>&lt;br />
  Summary:&lt;br />&lt;textarea name="introtext" cols="50" rows="5">[+introtext+]&lt;/textarea>&lt;br />
  Content:&lt;br />&lt;textarea name="content" cols="50" rows="8">[+content+]&lt;/textarea>&lt;br />
  &lt;input name="send" type="submit" value="Submit" />
&lt;/form>
&lt;script language="JavaScript" src="manager/media/script/datefunctions.js">&lt;/script>
&lt;script type="text/javascript">
  var elm_txt = {}; // dummy
  var pub = document.forms["ne_form"].elements["pub_date"];
  var nwpub_cal1 = new calendar1(pub,elm_txt);
  nwpub_cal1.path="[(base_url)]manager/media/";
  nwpub_cal1.year_scroll = true;
  nwpub_cal1.time_comp = true;	
  var unpub = document.forms["ne_form"].elements["unpub_date"];
  var nwpub_cal2 = new calendar1(unpub,elm_txt);
  nwpub_cal2.path="[(base_url)]manager/media/";
  nwpub_cal2.year_scroll = true;
  nwpub_cal2.time_comp = true;	
&lt;/script></pre></code>
	    <p class="note">Note that there are 2 hidden inputs: NewsEditorForm and editid. These 2
	       fields must be present in any custom template as they are used by the
	       snippet to control the action that must be performed.</p>
	    <h3>Custom form with template variable [*EditBlogContent*] for the contents</h3>
	    <code><pre>&lt;div id="ne_wrapper">
  &lt;form name="ne_form" method="post" action="[~[*id*]~]">
    &lt;!-- These 2 hidden input fields must be present in any custom NewsEditor form. -->
      &lt;input name="NewsEditorForm" type="hidden" value="on" />
      &lt;input name="editid" type="hidden" value="[+editid+]" />
    &lt;!-- End of mandatory fields. -->
    &lt;fieldset>
      &lt;h3>Modify news&lt;/h3>
      &lt;p><label for="pagetitle">Page title &lt;abbr title="The title displayed on the titlebar of the browser">?&lt;/abbr>: &lt;input name="pagetitle" id="pagetitle" type="text" size="40" value="[+pagetitle+]" />&lt;/label>&lt;/p>
      &lt;p><label for="longtitle">News title &lt;abbr title="The title of the news">?&lt;/abbr>: &lt;input name="longtitle" id="longtitle" type="text" size="40" value="[+longtitle+]" />&lt;/label>&lt;/p>
    &lt;/fieldset>
    &lt;br />
    &lt;fieldset>
      &lt;h3>The content&lt;/h3>
      &lt;p><label for="introtext">Summary (opzionale):&lt;br/>&lt;textarea name="introtext" cols="50" rows="5">[+introtext+]&lt;/textarea>&lt;/label>&lt;/p>
      &lt;p><label for="tvEditBlogContent">Content:&lt;br/>[*EditBlogContent*]&lt;/label>&lt;/p>
    &lt;/fieldset>
    &lt;br />
    &lt;fieldset>
      &lt;input name="send" type="submit" value="Save" class="button" />
      &lt;input name="reset" type="reset" value="Reset" class="button" />
    &lt;/fieldset>
  &lt;/form>
&lt;/div></pre></code>
	    <p>The correct usage of the snippet for this custom template is as follows:</p>
	    <code><pre>[!NewsEditor? &folder=`10` &postid=`2` &formtpl=`NewsEditorForm` &rtcontent=`tvEditBlogContent`!]</pre></code>
	    <h3>Template variables</h3>
	    <p>You make template variables as usual, except for the default contents
	       which must be initialized to the current value of the news that's been
	       edited. This is done via an @EVAL binding.</p>
	    <code><pre>@EVAL
  if (isset($_REQUEST['editid']) && $_REQUEST['editid'] != '') {
    $editid = $_REQUEST['editid'];
    $tbl = $modx->getFullTableName( 'site_content' );
    return $modx->db->getValue( "SELECT content FROM $tbl WHERE (id = $editid)");
  }
  return '';</pre></code>
	    <p class="note">Note that you must modify the 5th line to get the correct field from the
	       table: content or introtext (for the summary).</p>
        <hr>
		<h1>Putting it all together</h1>
		<p>To make front-end publishing a real possibility you must make the NewsManager
		   and the NewsEditor work together. Here I'll explain how you can manage this.</p>
		<ul>
		  <li>Make a folder which will serve as container for all you posts. Let's assume that it has the id 10.</li>
		  <li>Make a document with the NewsManager snippet: [!NewsManager? &folder=`10` !]. Let's assume that is has the id 11.</li>
		  <li>Make a document with the NewsEditor snippet: [!NewsEditor? &folder='10' &postid=`11` !]. Let's assume that is has the id 12.</li>
		  <li>Edit the NewsManager snippet to be: [!NewsManager? &folder=`11` &editformid=`12` !].</li>
		  <li>Add a link after the NewsManager: &lt;a href="[~12~]">Create new post.&lt;/a>.</li>
		</ul>
		<p>This is enough to have a basic front-end news manager in place. You can
		   adapt it to your taste by customizing the templates and the css.</p>
		<hr>
		<h1>A News Ticker</h1>
		<p>I tried to use the Ditto snippet to feed a news ticker but wasn't ablt to do this.
		   For now the only way in which I managed to make a dynamic news ticker was putting
		   an @EVAL binding in the default value of a ticker template variable:</p>
		<code><pre>@EVAL
  $tbl = $modx->getFullTableName('site_content');
  $id = 10;
  $rs = $modx->db->query( "SELECT PageTitle, Content FROM $tbl WHERE parent = $id AND published = 1" );
  $result = '';
  while ($row = $modx->db->getRow($rs)) {
    if ($result != '') $result .= '||';
    $result .= '<div class=\"na_row\"><h3>' . $row['PageTitle'] . '</h3><div class=\"na_content\">' . $row['Content'] . '</div></div>';
  }
  return $result;</pre></code>
        <p>You should replace $id = 10; with the id of your news folder and adapt the 8th line to your template.</p>
	  </div>
	</div>
  </body>
</html>